package cn.itcast.feign.client;
import cn.itcast.hmall.dto.common.ResultDTO;
import cn.itcast.hmall.pojo.user.Address;
import cn.itcast.hmall.pojo.user.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 用户服务 feign接口
 *
 * TODO 需要的接口自己补充哦
 */
@FeignClient("userservice")
public interface UserClient {
    /**
     * 根据id查询地址
     * @param addressId
     * @return
     */
    @GetMapping("/address/{addressId}")
    public Address queryAddressById(@PathVariable("addressId") Long addressId);

    /**
     * 根据id查询用户
     * @param uid
     * @return
     */
    @GetMapping("/address/user/{uid}")
    public User findUserById(@PathVariable("uid") Long uid);


    /**
     * 根据id修改用户
     * @param user
     * @return
     */
    @PutMapping("/address/user")
    public ResultDTO updateUserById(@RequestBody User user);
}
